package com.ts.simplemusic;

import android.os.Parcel;
import android.os.Parcelable;

import androidx.annotation.NonNull;

public class Music implements Parcelable {
    /**
     * 歌曲名
     */
    private String mTitle;
    /**
     * 歌手
     */
    private String mArtist;
    /**
     * 专辑名
     */
    private String mAlbum;
    /**
     * 路径
     */
    private String mPath;
    /**
     * 时长
     */
    private long mDuration;

    public Music() {
    }

    protected Music(Parcel in) {
        mTitle = in.readString();
        mArtist = in.readString();
        mAlbum = in.readString();
        mPath = in.readString();
        mDuration = in.readLong();
    }

    public static final Creator<Music> CREATOR = new Creator<Music>() {
        @Override
        public Music createFromParcel(Parcel in) {
            return new Music(in);
        }

        @Override
        public Music[] newArray(int size) {
            return new Music[size];
        }
    };

    public String getTitle() {
        return mTitle;
    }

    public void setTitle(String title) {
        this.mTitle = title;
    }

    public String getArtist() {
        return mArtist;
    }

    public void setArtist(String artist) {
        this.mArtist = artist;
    }

    public String getAlbum() {
        return mAlbum;
    }

    public void setAlbum(String album) {
        this.mAlbum = album;
    }

    public String getPath() {
        return mPath;
    }

    public void setPath(String path) {
        this.mPath = path;
    }

    public long getDuration() {
        return mDuration;
    }

    public void setDuration(long duration) {
        this.mDuration = duration;
    }

    @NonNull
    @Override
    public String toString() {
        return super.toString();
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(@NonNull Parcel dest, int flags) {
        dest.writeString(mTitle);
        dest.writeString(mArtist);
        dest.writeString(mAlbum);
        dest.writeString(mPath);
        dest.writeLong(mDuration);
    }
}
